home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ARASAN_S.ZIP / PINFO.H < prev    next >
C/C++ Source or Header  |  1994-07-31  |  2KB  |  78 lines

  1. // Copyright 1994 by Jon Dart.  All Rights Reserved.
  2.  
  3. #ifndef _PINFO_H
  4. #define _PINFO_H
  5.  
  6. #include "move.h"
  7. #include <stddef.h>
  8.  
  9. class Position_Info
  10. {
  11.     // this class represents one entry in the hash table.
  12.  
  13.     public:
  14.  
  15.     friend unsigned long hash_code(Position_Info &p);
  16.     
  17.     enum ValueType { Invalid, Valid, UpperBound, LowerBound };
  18.  
  19.     Position_Info( const Board &board, const int depth,
  20.                const ValueType hashflags,
  21.            const Boolean forced,
  22.            const int rep_count,
  23.            const int value,
  24.            const Move &best_move);
  25.  
  26.     // construct an object that can be used for searching:
  27.     Position_Info( const Board &board, int rep_count );
  28.     
  29.     int operator == ( const Position_Info &p)
  30.     {
  31.         return (my_hashcode == p.my_hashcode) &&
  32.            (my_xhashcode == p.my_xhashcode);
  33.     }
  34.  
  35.     ValueType type() const
  36.     {
  37.         return (ValueType)(my_flags & 0x7);
  38.     }
  39.     
  40.     Boolean forced() const
  41.     {
  42.      return (my_flags & 0x80) != 0;
  43.     }
  44.  
  45.     unsigned long hash_code() const
  46.     {
  47.         return my_hashcode;
  48.     }
  49.     
  50.     int depth() const
  51.     {
  52.     return my_depth;
  53.     }
  54.     
  55.     int value() const
  56.     {
  57.     return my_value;
  58.     }
  59.     
  60.     const Move &best_move() const
  61.     {
  62.     return my_best_move;
  63.     }
  64.  
  65.     private:
  66.  
  67.     signed char my_depth;
  68.     byte my_flags;
  69.     unsigned long my_hashcode;
  70.     int16 my_xhashcode;
  71.     int16 my_value;
  72.     Move my_best_move;
  73. };
  74.  
  75. unsigned long hash_code(const Position_Info &p);
  76.  
  77. #endif
  78.